#include "log/log.h"
#include <string.h>
#include "app_runner.h"
#include "ota_version.h"
#include "daemon_runner.h"

int main(int argc, char const *argv[])
{
    if (argc == 1)
    {
        log_error("至少要有一个参数");
        return -1;
    }
    // 判断是否是app => 运行app模块
    if (strcmp(argv[1], "app") == 0)
    {
        app_runner_run();
    }
    else if (strcmp(argv[1], "ota") == 0)
    {
        ota_version_checkDailyUpdate(); //自动升级程序,每24小时检查一次
    }
    else if (strcmp(argv[1], "daemon") == 0)
    {
        daemon_runner_start(); //以守护进程的方式启动 APP OTA
    }
    else if (strcmp(argv[1], "update") == 0)
    {
        ota_version_checkUpdate(); //手动升级程序
    }
    else if (strcmp(argv[1], "version") == 0)
    {
        ota_version_printVersion();
    }
    else
    {
        log_debug("请输入参数:(app|daemon|ota|version|update)");
    }

    return 0;
}
